Ext.define('NF.controller.FarmLivestockListCount',{
    extend:'Ext.app.Controller',
    views:['farm.FarmLivestockListCount','farm.FarmOperations','farm.FarmTabs','farm.FarmLivestockList','farm.LivestockMasterDetails','farm.LivestockSearchPanel'],
    stores:['FarmLivestockListCount','FarmLivestockList','LivestockSearch'],
    models:['FarmLivestockListCount','FarmLivestockList','LivestockSearch'],
    init:function(){
        this.control({
            'viewport > farmOperations > farmLivestockListCount':{itemdblclick:this.createLivestockListTab},
            'viewport > farmTabs > farmLivestockList':{itemdblclick:this.createLivestock}
        })
    },
    createLivestockListTab:function(grid,record){
        var farmTab = Ext.getCmp('farmTabsId');
        farmTab.addOrActivateTab({
           xtype:'farmLivestockList',
           context:{id:record.get('id'),name:record.get('name')}
        });
    },
    createLivestock:function(grid,record){
        var farmTab = Ext.getCmp('farmTabsId');
        farmTab.addOrActivateTab({
           xtype:'livestockMasterDetails',
           itemId:Ext.id('livestockMasterDetails'),
           context:{id:record.get('id'),name:record.get('name')}
        });
    }
});